/*
	PlAr is Platform Arena: a 2D multiplayer shooting game
	Copyright (c) 2010, Antonio Ragagnin <spocchio@gmail.com>
    All rights reserved.

    This file is licensed under the New BSD License.
 */

package res.elements;

import plar.core.Action;
import plar.core.ActionTouch;
import plar.core.Common;
import plar.core.Element;
import plar.core.Common.ElementType;
import plar.core.ElementGadget;
import plar.core.ElementPlayer;

public class Thorn extends  ElementGadget {
    public int damage;

    public Thorn() {
        super();
        isRunnable = true;
        this.setBoxShape(0.5f, 0.5f);
        damage=100;
        setTimer(false);
        spritechange=false;

    }

    public void elementCollided(Element e) {
        Common.info(1," This:"+this+ " Collided with"+e+"");
        if(e.type==Common.ElementType.PLAYER) {

            ElementPlayer p = ((ElementPlayer)e);
            ((ElementPlayer) e).lastTouch=null;
            p.energy-=damage;
        }

    }



}
